#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'Michael Liao'

'''
test save user
'''

import sys

import orm
from models import User, Blog, Comment
import asyncio

@asyncio.coroutine
def test( loop ):
    yield from orm.create_pool( loop = loop, user='root', password='root', db='awesome' )
    u = User(name='Test', email='test2@example.com', passwd='1234567890', image='about:blank')
    yield from u.save()

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(asyncio.wait([test(loop)]))
    loop.close()
    if loop.is_closed():
        sys.exit(0)